package com.zxn.dorm;

import android.app.Application;
import android.database.sqlite.SQLiteDatabase;

import com.zxn.dorm.greendao.DaoMaster;
import com.zxn.dorm.greendao.DaoSession;
import com.zxn.dorm.greendao.MemberBeanInfoDao;
import com.zxn.presenter.BaseApp;
import com.zxn.utils.UIUtils;


/**
 * Created by zxn on 2019/12/27.
 */
public class MjyApp extends BaseApp {

    public MemberBeanInfoDao mMemberBeanInfoDao;

    public static MjyApp mMjyApp;

    @Override
    public void onCreate() {
        super.onCreate();
        mMjyApp = this;
        UIUtils.init(this);

        initDB();
    }

    private void initDB() {
        DaoMaster.DevOpenHelper devOpenHelper
                = new DaoMaster.DevOpenHelper(this, "dorm_db", null);
        SQLiteDatabase database = devOpenHelper.getWritableDatabase();
        DaoMaster daoMaster = new DaoMaster(database);
        DaoSession daoSession = daoMaster.newSession();
        mMemberBeanInfoDao = daoSession.getMemberBeanInfoDao();
    }
}
